package com.sali.rule;

import org.apache.commons.lang3.StringUtils;


public class PasswordRule implements Rule {
    private static Rule rule;

    static {
        rule = new PasswordRule();
    }

    public static Rule getInstance() {
        return rule;
    }


    @Override
    public Object invoke(Object value) {
        String password = (String) value;
        if (StringUtils.isEmpty(password)) {
            return "";
        }
        if (!password.contains("(null)")) {
            return password;
        }

        return "";
    }


    public static void main(String[] args) {
        Rule instance = PasswordRule.getInstance();
        Object invoke = instance.invoke("heathcarerate.org> BODY=8BITMIME");
        System.out.println(invoke);
    }


}
